
function like(id){
	$.post('pics-vote.php?id='+id+'&vote=likes', '', function(response){
		switch (response){
		case 'voted' : 
			alert('Вече сте гласували.');
			break;
		case 'not-registered' : 
			alert('Моля, регистрирайте се за да гласувате :)'); 
			break;
		default: 
			var likes = document.getElementById(id+'-likes').innerHTML*1;
			likes += 1;
			document.getElementById(id + "-likes").innerHTML = likes;
			//disable vote buttons 
			document.getElementById(id + "-like-btn").style.opacity = 0.5;
			document.getElementById(id + "-dislike-btn").style.opacity = 0.5;
			document.getElementById(id + "-like-btn").onclick = '';
			document.getElementById(id + "-dislike-btn").onclick = '';
		}
	});
}
function dislike(id){
	$.post('pics-vote.php?id='+id+'&vote=dislikes', '', function(response){
		switch (response){
		case 'voted' : 
			alert('Вече сте гласували.');
			break;
		case 'not-registered' : 
			alert('Моля, регистрирайте се за да гласувате :)'); 
			break;
		default: 
			var dislikes = document.getElementById(id+'-dislikes').innerHTML*1;
			dislikes += 1;
			document.getElementById(id + "-dislikes").innerHTML = dislikes;
			//disable vote buttons 
			document.getElementById(id + "-like-btn").style.opacity = 0.5;
			document.getElementById(id + "-dislike-btn").style.opacity = 0.5;
			document.getElementById(id + "-like-btn").onclick = '';
			document.getElementById(id + "-dislike-btn").onclick = '';
		}
	});
}